package com.mall.controller;

import com.mall.pojo.Result;
import com.mall.service.layoutHeaderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class layoutController { //layout界面header层标题展示
    @Autowired
    private layoutHeaderService layoutHeaderService;
    @GetMapping("/tables")
    public Result showAllTables() {
        return Result.success(layoutHeaderService.findAll());
    }
    @GetMapping("/tables/{id}")
    public Result showTable(@PathVariable Integer id) {
        return Result.success(layoutHeaderService.findById(id));
    }
    @GetMapping("/category/{id}")
    public Result showCategory(@PathVariable Integer id) {
        return Result.success(layoutHeaderService.findById(id));
    }
    @GetMapping("/category")
    public Result showAllCategory() {
        return Result.success(layoutHeaderService.findAll());
    }
}
